// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

// import Vue from 'vue'
import App from './App'
import router from './router'


import store from './store'

if (process.env.NODE_ENV === "development") {
  axios.defaults.baseURL = '/apis';
}

axios.interceptors.request.use(function (config) {
    //拿一下token
    const token = '05bcb967da091d8e1e1f8649f92353d2'
    if(token){
      config.headers.token = token
    }else{
      // if(localStorage.getItem('token')){
      //   config.headers.Authorization = 'bearer ' + localStorage.getItem('token')
      //   store.commit('addtoken',localStorage.getItem('token'));
      // }else{
      //   // router.push('/login')
      // }
    }
    return config;
}, function (error) {
    return Promise.reject(error);
});

Vue.config.productionTip = false

import {copy,go,openw,back} from './assets/changyong.js'
Vue.prototype.copy = copy
Vue.prototype.go = go
Vue.prototype.openw = openw
Vue.prototype.back = back


// router.beforeEach((to, from, next) => {
//   if(from.path == '/order' && from.to == '/index'){

//   }
//   next()
// })

new Vue({
	el: '#app',
	router,
  store,
	components: {
		App
	},
	template: '<App/>'
})
